package com.dayuanit.dy16.atm.boatm.handler;

import com.alibaba.excel.EasyExcel;
import com.dayuanit.dy16.atm.boatm.service.ISalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.FileInputStream;

@Component
public class ExcelHander {

    @Autowired
    private ISalaryService salaryService;

    @Value("${atm.file.path}")
    private String filePath;
    public void readExcel(String fileName, long salaryId) throws Exception {
        FileInputStream fileInputStream = new FileInputStream(filePath + fileName);
        EasyExcel.read(fileInputStream, ExcelDataListener.SalaryExcelData.class, new ExcelDataListener(salaryService, salaryId)).sheet().doRead();
    }
}
